import request from "@/utils/request";

export function getMaterialCategory() {
  return request({
    url: "material/categories/",
    method: "GET",
  });
}

export function getMaterialList({
  second_category_id,
  tag_id,
  offset,
  limit,
  first_category_id,
  name = undefined,
  tag_names = undefined,
}) {
  return request({
    url: "material/m_list/",
    method: "POST",
    data: {
      offset,
      name,
      limit,
      first_category_id,
      second_category_id,
      tag_id,
      tag_names,
    },
  });
}

export function getMaterialDetail({ id }) {
  return request({
    url: `material/detail/`,
    method: "GET",
    params: {
      material_id: id,
    },
  });
}
